[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
BOOL pascal SetTimer(HWND hWnd, WORD id, WORD interval,
long (pascal *timerFunc)())
This function creates and initializes a timer. Interval specifies
the number of milliseconds to wait for before a WM_TIMER message is
generated. When the specified interval elapses, one of the following
actions takes place :
1) If there is a timerfunc associated with this timer, the timer
function will be called as follows :
(*CurrTimer->func)(timer_hWnd, WM_TIMER, timer_id, current_time);
Please note that your timer function must be declared with the "long
pascal" calling convention. This is how a timerfunc would be declared:
long pascal Timerfunc(HWND hTimerWnd, WORD message, WORD wParam,
DWORD lparam)
2) If no timerfunc was specified, a timer event will be placed into
the system queue with wParam set to the timer's id and lParam set to
the current system time.
The time will be checked whenever the system checks for pending
events. Therefore, a timer event may not be generated precisely on
time if the application "hogs" the time. Also, please note that the
IBM PC generates a timer interrupt 18.2 times per second (once every
55 milliseconds), so the granularity of the timer is limited.
Parameters
hWnd is the handle of the window which should receive the WM_TIMER
message.
id is the identifier associated with the created timer.
interval is the number of milliseconds to wait for before generating
a WM_TIMER message.
timerfunc is a pointer to a function which will receive the WM_TIMER
message. If this is NULL, the message will be placed into the system
event queue.
Returns
TRUE if the timer was created, FALSE if not.
Example
See the demonstration program TIMEDEMO which is distributed with
MEWEL. This program is a great example of using multiple timers.
.
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson